// 
// Decompiled by Procyon v0.5.36
// 

package com.orange.boot.utils;

import com.gargoylesoftware.htmlunit.*;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptErrorListener;

import java.net.MalformedURLException;
import java.net.URL;

public class WebClientUtils {
    public WebClientUtils() {
    }

    public static WebClient getWebClient() {
        WebClient webClient = new WebClient(BrowserVersion.FIREFOX);
        webClient.getOptions().setCssEnabled(false);
        webClient.getOptions().setJavaScriptEnabled(true);
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());
        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.waitForBackgroundJavaScript(3000L);
        webClient.getCookieManager().setCookiesEnabled(true);
        webClient.setJavaScriptErrorListener(new JavaScriptErrorListener() {
            public void scriptException(HtmlPage htmlPage, ScriptException e) {
            }

            public void timeoutError(HtmlPage htmlPage, long l, long l1) {
            }

            public void malformedScriptURL(HtmlPage htmlPage, String s, MalformedURLException e) {
            }

            public void loadScriptError(HtmlPage htmlPage, URL url, Exception e) {
            }

            public void warn(String s, String s1, int i, String s2, int i1) {
            }
        });
        return webClient;
    }
}
